package com.sample.entity;

// Generated Dec 9, 2014 1:42:52 PM by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Section generated by hbm2java
 */
@Entity
@Table(name = "section", catalog = "cqp_prime", uniqueConstraints = @UniqueConstraint(columnNames = "SECTION"))
public class Section implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Bu bu;
	private String section;
	private Set<Department> departments = new HashSet<Department>(0);

	public Section() {
	}

	public Section(String section) {
		this.section = section;
	}

	public Section(Bu bu, String section, Set<Department> departments) {
		this.bu = bu;
		this.section = section;
		this.departments = departments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "bu_id")
	public Bu getBu() {
		return this.bu;
	}

	public void setBu(Bu bu) {
		this.bu = bu;
	}

	@Column(name = "SECTION", unique = true, nullable = false, length = 45)
	public String getSection() {
		return this.section;
	}

	public void setSection(String section) {
		this.section = section;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "section")
	public Set<Department> getDepartments() {
		return this.departments;
	}

	public void setDepartments(Set<Department> departments) {
		this.departments = departments;
	}

}
